<?php 
define('_VIEW_MODEL_','default');
include("./init.php");
require_once INC.'/pageclass.php';
$sid = array();
//$pageObj = new Page(34,10,$smartyObj);
$id = isset($id)?intval($id):"";
if(!empty($id)){
	$name = $db->GetRow("select name from {$telper}user where id = $id");
	$username = $name['name'];
}else{
	$username = "不存在";
}
$rs = $db->Execute("select `id`,`title` from {$telper}bbs_column where level = '1' and state = 0 order by rank desc");
$fhead = $rs ->GetArray();
foreach($fhead as $k=>$v){
	$info[$k]['id'] = $v['id'];
	$info[$k]['ti'] = $v['title'];
	$sid[] = $v['id'];
}
$seid = implode(',', $sid);
$rq = $db->Execute("select `id`,`title`,`pid` from {$telper}bbs_column where pid in ($seid) and state = 0 order by rank desc");
$shead = $rq->GetArray();
$time = time();
$year = date("Y",$time);
$month = date('m',$time);
$day  = date("d",$time);
$tom  = $day+1;
$today = mktime(0,0,0,$month,$day,$year);
$tomar = mktime(0,0,0,$month,$tom,$year);
//echo "select `id`,count(id) from {$telper}bbs_cont where column2 in ($seid) and state = 0 and date('d',created) = $dat";
$rp = $db->Execute("select `id`,count(id),column2 from {$telper}bbs_cont where column2 in {$seid} and state = 0 and created > $today and created <$tomar");
$rqq = $rq->GetArray();
foreach($rqq as $k=>$v){
	$num[$v['column2']] = $v['count(id)']; 
}
foreach($shead as $k=>$v){
	$v['num'] = !empty($num)?$num[$v['pid']]:'0';
	$seinfo[$v['pid']][] = $v;
	}
//print_R($seinfo);
$date = date("m/d H:i:s");
header("Content-type:text/vnd.wap.wml;charset=utf-8");
$smartyObj->assign("hestyle",$helpstyle);
$smartyObj->assign("info",$info);
$smartyObj->assign("date",$date);
$smartyObj->assign("seinfo",$seinfo);
$smartyObj->assign("uid",$id);
$smartyObj->assign("name",$username);
$smartyObj->display("bbscont.tpl");

?>